const Controller = require('egg').Controller;
class LiveController extends Controller {
	async getLiveList() {
		const {
			ctx
		} = this
		const data = await ctx.service.live.getLiveList()
		ctx.body = {
			code: 1,
			data
		}
	}
	async delLiveList() {
		const {
			ctx
		} = this
		const data = await ctx.service.live.delLiveList()
		if (data.affectedRows >= 1) {
			ctx.body = {
				code: 1,
				message: '删除成功'
			}
		} else {
			ctx.body = {
				code: 0,
				message: '删除失败'
			}
		}
	}
	async editType() {
		const {
			ctx
		} = this;
		const data = await ctx.service.live.editType()
		if (data.affectedRows >= 1) {
			ctx.body = {
				code: 1,
				message: '修改状态成功'
			}
		} else {
			ctx.body = {
				code: 0,
				message: '修改状态失败'
			}
		}
	}
	async detailList() {
		const {ctx}=this
		const data = await ctx.service.live.detailList()
		ctx.body = {
			code: 1,
			data
		}
	}
}

module.exports = LiveController;